
module.exports = async(ctx, next) => {
    // 记录开始时间
    const start = Date.now();
    // 让内层中间件得到执行
    await next();

    const end = Date.now();
    const duration = end - start;
    console.log(duration, "玩蛇")
    
    // 设置响应头 
    ctx.set('X-Response-Time', duration + 'ms');
}